var yuanwen = prompt("请输入四位数","")
jiami(yuanwen);

function jiami(yuanwen){
    console.log('原始：' + yuanwen);
    //每一位
    var qian = (parseInt(yuanwen / 1000) + 5) % 10; 
    var bai = (parseInt(yuanwen % 1000 / 100) + 5) % 10;
    var shi = (parseInt(yuanwen % 100 / 10) + 5) % 10;
    var ge = (parseInt(yuanwen % 10) + 5) % 10;
    console.log(qian,bai,shi,ge);
    //定义新变量存数据
    var num = ge + "" + shi + "" + bai + "" + qian;
    console.log(num);
    return num;
}